{include file='_header'}
 
<div class="page-header">
    <span>当前位置：<span class="text-primary"> {if !empty($item['id'])}编辑{else}添加{/if}权限 <small>{if !empty($item['id'])}修改【{$item['title']}】{/if}</small></span></span>

</div>
 <div class="page-content">
     <div class="page-sub-toolbar">
         <span class=''>
            <a class="btn btn-primary btn-sm" href="{:url('admin/perm/roleadd')}">添加新权限</a>
        </span>
     </div>
    <form action="" method="post" class="form-horizontal form-validate" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$item['id']}" />
        <div class="form-group">
            <label class="col-lg control-label must">权限名称</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="title" class="form-control" value="{$item['title']}" data-rule-required="true" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label must">权限规则</label>
            <div class="col-sm-9 col-xs-12">
                <input type="text" name="name" class="form-control" value="{$item['name']}" data-rule-required="true" />
                <span class="help-block">请按照 “模块名-控制器名-方法名”</span>
            </div>
        </div>
        {if !empty($parent)}
        <div class="form-group">
            <label class="col-lg control-label">上级分类</label>
            <div class="col-sm-9 col-xs-12" >{$parent['title']}</div>
            <input type="hidden" name="pid" value="{$parent['id']}">
        </div>
        {else}
        <div class="form-group">
            <label class="col-lg control-label must">上级权限</label>
            <div class="col-sm-9 col-xs-12">
                <select class='form-control' name='pid'>
                    <option value='0'>--顶级权限--</option>
                    {foreach name='parents' item='p'}
                    <option value="{$p['id']}" {if $item['pid']==$p['id']}selected{/if}>{$p['title']}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        {/if}
        <div class="form-group">
            <label class="col-lg control-label">状态</label>
            <div class="col-sm-9 col-xs-12">
                <label class='radio-inline'>
                    <input type='radio' name='status' value=1' {if $item['status']==1}checked{/if} /> 启用
                </label>
                <label class='radio-inline'> 
                    <input type='radio' name='status' value=0' {if $item['status']==0}checked{/if} /> 禁用
                </label>
                <span class="help-block">如果禁用，则当前权限组的操作员全部会禁止使用</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <input type="submit" value="提交" class="btn btn-primary"  />
               <input type="button" name="back" onclick='history.back()' style='margin-left:10px;' value="返回列表" class="btn btn-default" />
            </div>
        </div>
    </form>
 </div>
{include file='_footer'}